package com.woniu.cinema.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.woniu.common.annotation.Log;
import com.woniu.common.core.controller.BaseController;
import com.woniu.common.core.domain.AjaxResult;
import com.woniu.common.enums.BusinessType;
import com.woniu.cinema.domain.UnauthUri;
import com.woniu.cinema.service.UnauthUriService;
import com.woniu.common.utils.poi.ExcelUtil;
import com.woniu.common.core.page.TableDataInfo;

/**
 * 不需要验证是否登录的uriController
 * 
 * @author yy
 * @date 2023-09-27
 */
@RestController
@RequestMapping("/cinema/unauthuri")
public class UnauthUriController extends BaseController
{
    @Autowired
    private UnauthUriService unauthUriService;

    /**
     * 查询不需要验证是否登录的uri列表
     */
    @GetMapping("/list")
    public TableDataInfo list(UnauthUri unauthUri)
    {
        startPage();
        List<UnauthUri> list = unauthUriService.selectUnauthUriList(unauthUri);
        return getDataTable(list);
    }

    /**
     * 导出不需要验证是否登录的uri列表
     */
    @Log(title = "不需要验证是否登录的uri", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(UnauthUri unauthUri)
    {
        List<UnauthUri> list = unauthUriService.selectUnauthUriList(unauthUri);
        ExcelUtil<UnauthUri> util = new ExcelUtil<UnauthUri>(UnauthUri.class);
        return util.exportExcel(list, "unauthuri");
    }

    /**
     * 获取不需要验证是否登录的uri详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(unauthUriService.selectUnauthUriById(id));
    }

    /**
     * 新增不需要验证是否登录的uri
     */
    @Log(title = "不需要验证是否登录的uri", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UnauthUri unauthUri)
    {
        return toAjax(unauthUriService.insertUnauthUri(unauthUri));
    }

    /**
     * 修改不需要验证是否登录的uri
     */
    @Log(title = "不需要验证是否登录的uri", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UnauthUri unauthUri)
    {
        return toAjax(unauthUriService.updateUnauthUri(unauthUri));
    }

    /**
     * 删除不需要验证是否登录的uri
     */
    @Log(title = "不需要验证是否登录的uri", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(unauthUriService.deleteUnauthUriByIds(ids));
    }
}
